package com.example.learn_spring_boot3.controller;

import com.example.learn_spring_boot3.service.TestMysqlService;
import com.example.learn_spring_boot3.utils.ResponseData;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/testMysql")
public class TestMysqlController {

    @Autowired
    TestMysqlService TestMysqlService;


    @GetMapping("/queryUserList")
    public ResponseEntity<ResponseData> queryUserList() {
        return TestMysqlService.queryUserList();
    }

    @PostMapping("/addUser")
    public ResponseEntity<ResponseData> addUser() {
        return TestMysqlService.addUser();
    }

    @PostMapping("/deleteUser/{id}")
    public ResponseEntity<ResponseData> deleteUser(@PathVariable("id") int id) {
        return TestMysqlService.deleteUser(id);
    }
}